<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>余杭交警多维数据管理平台 | 登录</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/static/dashboard/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="http://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="http://cdn.staticfile.org/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/static/dashboard/dist/css/AdminLTE.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="/static/dashboard/plugins/iCheck/square/blue.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="http://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <!-- /.login-logo -->
    <div class="login-box-body">
        <div class="login-logo">
            <a href="#"><b>余杭交警多维数据管理平台1</b></a>
        </div>
        <hr />

        <div class="form-group has-feedback">
            <input type="text" id="input_username" class="form-control" placeholder="用户名">
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
        </div>
        <div class="form-group has-feedback">
            <input type="password" id="input_password" class="form-control" placeholder="密码">
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
        </div>

        <p class="login-box-msg"></p>

        <div class="row">
            <!-- /.col -->
            <div class="col-xs-12">
                <button type="submit" class="btn btn-primary btn-block btn-flat" id="btn-login">登录</button>
            </div>
            <!-- /.col -->
        </div>
    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<script src="/static/dashboard/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/static/dashboard/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="/static/dashboard/plugins/iCheck/icheck.min.js"></script>
<script>
    $(function () {
        $(document).keypress(function(e) {
            // 回车键事件
            if(e.which == 13) {
                $("#btn-login").click();
            }
        });

        $("#btn-login").click(function () {
            $.post("/dashboard/login", {
                username: $("#input_username").val(),
                password: $("#input_password").val()
            }, function (r) {
                if (r["code"] == 200) {
                  window.location.href = "/dashboard";
                }
                else{
                    $(".login-box-msg").css("color", "#FF0000");
                    $(".login-box-msg").text(r["message"]);
                }
            });
        });
    });
</script>
</body>
</html>
